<?php

/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/

use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\Facades\Route;

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

// 测试使用 jwt 验证私有频道无法订阅成功，网上教程都是使用 laravel-echo-server 而不是 pusher，
// 配置又多很多，不打算使用 laravel-echo 广播
//Route::get('private-channel-test', function () {
//    return view('laravel-echo.private-test');
//})->middleware('web');